$main-color: #006646;
$u-border-color: #d9d9d9;

@function toRem($a){
  @return ($a/16)+rem;  

}

.main-color{color: $main-color;}
.main-bg{background: $main-color;}

.u-sticky{position: sticky;top: 0;}
.u-relative{position: relative;}
.u-absolute{position: absolute;}

.u-fixed{position: fixed;top: 0;}
.u-text-nowrap{white-space: nowrap;}
.u-btn{cursor: pointer;}
.u-flex {display: flex;flex-direction: row;align-items: center;height: 100%;}
.u-flex-top {display: flex;flex-direction: row;height: 100%;}
.u-flex-to {display: flex;flex-direction: row;}
.u-flex-wrap {flex-wrap: wrap;}
.u-float {display: inline-block;}
.u-col-center {align-items: center;}
.u-col-top {align-items: flex-start;}
.u-col-bottom {align-items: flex-end;}
// .u-row-center {justify-content: center;}
.u-center {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);}
.u-video {position: absolute;top: 250%;left: 50%;transform: translate(-50%, -50%);}
.u-block {display: block;}
.u-margin-auto {margin: 0 auto;}
.u-row-center {position: absolute;left: 50%;transform: translateX(-50%);}
.u-row-around {justify-content: space-around;}
.u-row-evenly {justify-content: space-evenly;}
.u-row-between {justify-content: space-between;}
.u-h2 {font-size: 1rem;font-weight: 700;}
.u-text-center {text-align: center;}
.u-background-image {background-image: url(../img/mbg.png);}
.u-flex-col {display: flex;flex-direction: column;align-items: center;}
.u-open {
  height: toRem(100);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.rate li {
    margin-inline-end: toRem(3) !important;
}
.ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
div:has(.mess) {
  height: 100%;
}
.mess {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.footer {
  position: fixed;
  left: 0;
  bottom: 0;
  height: toRem(50);
  width: 100%;
}
.footerimg {
  display: inline-block;
  width: toRem(20);
  height: toRem(20);
}

/* start--文本行数限制--start */
.u-line {
  overflow: hidden;
  white-space: normal;
  word-break: break-all;
  text-overflow: ellipsis;
  display: -webkit-box; // 弹性伸缩盒
  -webkit-box-orient: vertical; // 设置伸缩盒子元素排列方式
}
@for $i from 1 through 5 {
  .u-line-#{$i} {
    @extend .u-line;
    -webkit-line-clamp: $i;
  }
}

.u-border,
.u-border-bottom,
.u-border-left,
.u-border-right,
.u-border-top,
.u-border-top-bottom {
  position: relative;
}
/* start--Retina 屏幕下的 1px 边框--start */
.u-border-bottom:after,
.u-border-left:after,
.u-border-right:after,
.u-border-top-bottom:after,
.u-border-top:after,
.u-border:after {
  content: ' ';
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  box-sizing: border-box;
  -webkit-transform-origin: 0 0;
  transform-origin: 0 0;
  width: 199.8%;
  height: 199.7%;
  transform: scale(0.5, 0.5);
  border: 0 solid $u-border-color;
  z-index: 2;
}

.u-border-top:after {
  border-top-width: 1px
}

.u-border-left:after {
  border-left-width: 1px
}

.u-border-right:after {
  border-right-width: 1px
}

.u-border-bottom:after {
  border-bottom-width: 1px
}

.u-border-top-bottom:after {
  border-width: 1px 0
}

.u-border:after {
  border-width: 1px
}
/* end--Retina 屏幕下的 1px 边框--end */

// 定义行高
@for $i from 1 through 5 {
  .u-line-height-#{$i}, .u-l-h-#{$i} {
    line-height: $i;
  }
}
// 定义flex等分
@for $i from 0 through 12 {
  .u-flex-#{$i} {
    flex: $i;
  }
}
// 定义字体(px)单位，小于20都为px单位字体
@for $i from 12 to 40 {
  .u-font-#{$i} {
    font-size: toRem($i);
  }
}
// 定义内外边距，历遍1-80
@for $i from 0 through 100 {
  // 只要双数和能被5除尽的数
  @if $i % 2 == 0 or $i % 5 == 0 {
    // 得出：u-margin-30或者u-m-30
    .u-margin-#{$i}, .u-m-#{$i} {
      margin: toRem($i)!important;
    }

    // 得出：u-padding-30或者u-p-30
    .u-padding-#{$i}, .u-p-#{$i} {
      padding: toRem($i)!important;
    }

    @each $short, $long in l left, t top, r right, b bottom {
      // 缩写版，结果如： u-m-l-30
      // 定义外边距
      .u-m-#{$short}-#{$i} {
        margin-#{$long}: toRem($i)!important;
      }

      // 定义内边距
      .u-p-#{$short}-#{$i} {
        padding-#{$long}: toRem($i)!important;
      }

      // 完整版，结果如：u-margin-left-30
      // 定义外边距
      .u-margin-#{$long}-#{$i} {
        margin-#{$long}: toRem($i)!important;
      }

      // 定义内边距
      .u-padding-#{$long}-#{$i} {
        padding-#{$long}: toRem($i)!important;
      }
    }
  }
}